﻿using System.Collections.Generic;
using Volunteering.model;

namespace Volunteering.service {
  public class SearchByKeys : ICommand {
    public string Keys { get; }

    public SearchByKeys(string keys) {
      Keys = keys;
    }
  }

  public class SearchBySubjects : ICommand {
    public SearchBySubjects(Subjects main, HashSet<Subjects> extension) {
      Main = main;
      Extension = extension;
    }

    public Subjects Main { get; }
    public HashSet<Subjects> Extension { get; }
  }

  public class SpecialityService {
    private readonly SpecialityRepository repository;

    public SpecialityService(SpecialityRepository repository) {
      this.repository = repository;
    }

    public List<Speciality> OnCommand(SearchByKeys cmd) {
      return repository.FindByKeys(cmd.Keys);
    }

    public List<Speciality> OnCommand(SearchBySubjects cmd) {
      return repository.FindBySubjects(cmd.Main, cmd.Extension);
    }
  }
}
